const express = require('express');
const router = express.Router();
const userController = require('../../controllers/admin/user.controller');
const auth = require('../../middlewares/auth');
const role = require('../../config/roles');
const validate = require('../../middlewares/validate');
const userValidation = require('../../validations/user.validation');

// 创建教师账号
router.post(
  '/teachers',
  auth(role.ADMIN),
  validate(userValidation.createTeacher),
  userController.createTeacher
);

// 批量导入学生账号
router.post(
  '/students/batch',
  auth(role.ADMIN),
  validate(userValidation.batchCreateStudents),
  userController.batchCreateStudents
);

// 禁用/启用账号
router.patch(
  '/:userId/status',
  auth(role.ADMIN),
  validate(userValidation.updateUserStatus),
  userController.updateUserStatus
);

// 搜索用户
router.get(
  '/search',
  auth(role.ADMIN),
  validate(userValidation.searchUsers),
  userController.searchUsers
);

module.exports = router;